package by.pavlyukevich.paymentsystem.datamodel.user;

import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import by.pavlyukevich.paymentsystem.datamodel.AbstractEntity;

@Entity
public class Individual extends AbstractEntity<Integer> {

	@Column
	@NotNull
	@Size(max = 50)
	private String name;

	@Column
	@NotNull
	@Size(max = 100)
	private String family;

	@Column
	private Date birthday;

	@Column
	@NotNull
	@Size(max = 100)
	private String email;

	@OneToMany(mappedBy = "individual", cascade = { CascadeType.ALL }, orphanRemoval = true)
	private Set<UserAccount> userAccounts;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getFamily() {
		return family;
	}

	public void setFamily(String family) {
		this.family = family;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Set<UserAccount> getUserAccounts() {
		return userAccounts;
	}

	public void setUserAccounts(Set<UserAccount> userAccounts) {
		this.userAccounts = userAccounts;
	}

}
